package homework6.com.zut.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import homework6.com.zut.dao.UserDao;
import homework6.com.zut.pojo.Page;
import homework6.com.zut.pojo.User;
import homework6.com.zut.service.UserService;

@Service("userService")
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	@Override
	@Transactional(readOnly=true)
	public List<User> findByIds(List<Integer> ids) {
		return userDao.findUserByIds(ids);
	}

	@Override
	@Transactional(readOnly=true)
	public List<User> findByInfo(User user) {
		return userDao.findUserByInfo(user);
	}

	@Override
	@Transactional(readOnly=true)
	public List<User> findByPage(Page page) {
		return userDao.findUserByPage(page);
	}

	@Override
	@Transactional(readOnly=false)
	public void update(User user) {
		userDao.updateUser(user);
	}

	@Override
	@Transactional(readOnly=false)
	public void add(User user) {
		userDao.addUser(user);
	}

	@Override
	@Transactional(readOnly=true)
	public User findByOid(String number) {
		return userDao.findUserByOid(number);
	}

}